<!--混凝土拌和站---动态监控--实时监控-->
<!--
 * @Author: 卡卡 1071780426@qq.com
 * @Date: 2022-12-02 13:13:25
 * @LastEditors: CNN 969682281@qq.com
 * @LastEditTime: 2023-06-30 14:38:39
 * @FilePath: \backstage - 副本\src\views\aa.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="department" id="department">
    <!-- 左侧部门管理 -->
    <div class="structureTree" v-if="treelength">
      <div class="structureTree_title">
        <div>组织机构</div>
        <div>
          <!-- <el-checkbox v-model="checked" @change="see()">查看下级</el-checkbox> -->
        </div>
      </div>
      <tree
        :treeData="treeData"
        :checkData="checkData"
        nodeKey="fCompanyid"
        @getTreeInfo="handleNodeClick"
        :defaultProps="defaultProps"
      >
      </tree>
    </div>
    <!-- 右侧 -->
    <div class="department_right">
      <!-- 机构名称 -->
      <el-breadcrumb :title="showName"></el-breadcrumb>
      <!-- 顶部导航栏 -->
      <div class="mechanism_nav">
        <!-- 左侧 -->

        <div class="mechanism_nav_left" style="width: 100%">
          <el-date-picker
            @change="selectTime"
            v-model="value2"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
          <el-select
            class="selectQd"
            style="width: 100px"
            v-model="getList.strengthgrade"
            placeholder="强度等级"
            @change="yj_searchForm(getList)"
          >
            <el-option
              v-for="v in strengthGradeDataList"
              :key="v.fItemName"
              :label="v.fItemName"
              :value="v.fItemValue"
            >
            </el-option>
          </el-select>

          <!--<el-select class="selectBhz" v-model="getList.stationId" placeholder="所有拌和站"
                        @change="yj_searchForm(getList)">
                        <el-option v-for="v in bhzDataList" :key="v.fItemName" :label="v.fItemName"
                            :value="v.fItemValue">
                        </el-option>
                    </el-select>
                     <el-select class="selectBhz" v-model="getList.machineId" placeholder="所有拌和机"
                        @change="yj_searchForm(getList)">
                        <el-option v-for="v in bhjDataList" :key="v.fItemName" :label="v.fItemName"
                            :value="v.fItemValue">
                        </el-option>
                    </el-select>
                    <el-select class="selectCondition" v-model="getList.warningLevel" placeholder="预警等级"
                        @change="yj_searchForm(getList)">
                        <el-option v-for="v in djDataList" :key="v.fItemName" :label="v.fItemName"
                            :value="v.fItemValue">
                                                                                </el-option>
                                                                            </el-select>

                                                                            <el-select class="selectCondition" v-model="getList.fCloseoperation" placeholder="闭合状态"
                                                                                @change="yj_searchForm(getList)">
                        <el-option v-for="v in CloseoperationDataList" :key="v.fItemName" :label="v.fItemName"
                            :value="v.fItemValue">
                        </el-option>
                                                                            </el-select> -->
          <input
            class="projectBW"
            type="text"
            placeholder="工程名称/工程部位"
            v-model="getList.keyWord"
          />
          <el-button
            type="primary"
            icon="el-icon-search"
            size="small"
            v-if="yj_view"
            @click="yj_searchForm(getList)"
            >查询
          </el-button>
          <!-- <download-excel class="blueBtn" :data="tableDatas" :fields="json_fields" worksheet="My Worksheet"
                                                                                :name="xlsxName">
                                                                                <el-button type="primary" icon="el-icon-refresh" size="small">导出文件</el-button>
                                                                            </download-excel> -->
        </div>
        <!-- 顶部按钮 -->
        <div class="print"></div>
      </div>

      <!-- 表格 -->
      <div class="text_table">
        <!-- <div :id="('select' + index)" v-for="(item, index) in tableData" :key="index">12</div> -->
        <tableData
          :config="table_config"
          :dataList="tableData"
          :loading="listLoading"
          @selection-change="selectionChange"
          @sort-change="sortChange"
          @click-change="rowChange"
          @openDialog="yj_viewForm"
          :page="getList.page"
          :pageSize="getList.pageSize"
        />

        <pagination
          :info="queryCriteriaData"
          v-if="navigatepageNums > 1"
          :treelength="treelength"
          :total="queryCriteriaData.total"
          :pageNum.sync="getList.page"
          :limit.sync="getList.pageSize"
          @pagination="yj_searchForm(getList)"
        />
      </div>

      <!--弹框 查看 -->
      <div class="Control-1 mechanism_dialogS">
        <el-dialog
          title="查看"
          :modal-append-to-body="false"
          v-dialogDrag
          :visible.sync="dialogEditVisible"
          v-loading="loadingEditDialog"
          element-loading-text="拼命加载中"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.2)"
        >
          <div class="dialogBody common" :style="{ height: '550px' }">
            <div class="baseTitle">基本信息</div>
            <div style="height: 230px">
              <publicForm
                ref="publicForm"
                lableWidth="95px"
                :formObj="formObj"
                :formData="formData"
              >
              </publicForm>
            </div>
            <div class="baseTitle">材料用量</div>
            <div
              style="height: 137px; margin-top: 8px"
              class="levelClass materialClass"
            >
              <!--  -->
              <tableData
                :config="material_config"
                :dataList="materialData"
                statusType="2"
                :level="level"
                :earlyWarning="earlyWarning"
                :currentRow="false"
                :stripe="false"
              />
            </div>
          </div>
        </el-dialog>
      </div>
    </div>
  </div>
</template>
  
<script>
import tree from "@/components/public/el-trees"; //左侧机构树
import TableData from "@/components/public/el-tables"; //主页面列表
import Pagination from "@/components/public/el-pagination"; //主页面分页
import elBreadcrumb from "@/components/public/el-breadcrumb.vue"; //面包屑
import publicForm from "@/components/public/el-form.vue"; //弹框form
// import selects from "@/components/public/el-select.vue"

import formJs from "./regexDetail.js"; //新增弹框配置项
import {
  getUserCompanyTreeList, //左侧机构树接口
  getMixListByCompanyId, //主页面列表接口
  getMixInfoById, //主页面列表详情接口
  getStationmachineByfMachineid, //查询-拌合站信息-详情接口
  getStationmachineList, //拌合站列表
} from "@/api/request.js";
import { statusType } from "@/utils/config"; //配置项
export default {
  name: "dosageDeviation",
  data() {
    return {
      name: "dosageDeviation", //按钮配置页面代号
      yj_view: null, //查看按钮是否显示
      formObj: formJs.formObj, //新增编辑配置参数
      formData: {}, //新增编辑向后台传递对象
      navigatepageNums: null, //是否显示分页
      queryCriteriaData: {}, //分页
      pickerOptions: {
        //主页面日期筛选 带快捷选项
        disabledDate(time) {
          return time.getTime() > Date.now();
          // return time.getTime() > Date.now();  // 可选历史天、可选当前天、不可选未来天
          // return time.getTime() > Date.now() - 8.64e7;  // 可选历史天、不可选当前天、不可选未来天
          // return time.getTime() < Date.now() - 8.64e7;  // 不可选历史天、可选当前天、可选未来天
          // return time.getTime() < Date.now(); // 不可选历史天、不可选当前天、可选未来天
        },
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              console.log(start);
              start.setTime(start.getTime());
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "昨天",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              console.log(start);
              start.setTime(start.getTime() - 3600 * 1000 * 24);
              end.setTime(end.getTime() - 3600 * 1000 * 24);

              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一年",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      strengthGradeDataList: [
        {
          fItemName: "强度等级",
          fItemValue: "",
        },
        {
          fItemName: "C10",
          fItemValue: "C10",
        },
        {
          fItemName: "C15",
          fItemValue: "C15",
        },
        {
          fItemName: "C20",
          fItemValue: "C20",
        },
        {
          fItemName: "C25",
          fItemValue: "C25",
        },
        {
          fItemName: "C30",
          fItemValue: "C30",
        },
        {
          fItemName: "C35",
          fItemValue: "C35",
        },
        {
          fItemName: "C40",
          fItemValue: "C40",
        },
        {
          fItemName: "C45",
          fItemValue: "C45",
        },
        {
          fItemName: "C50",
          fItemValue: "C50",
        },
        {
          fItemName: "C55",
          fItemValue: "C55",
        },
        {
          fItemName: "C60",
          fItemValue: "C60",
        },
        {
          fItemName: "C65",
          fItemValue: "C65",
        },
        {
          fItemName: "C70",
          fItemValue: "C70",
        },
        {
          fItemName: "C75",
          fItemValue: "C75",
        },
        {
          fItemName: "C80",
          fItemValue: "C80",
        },
        {
          fItemName: "C85",
          fItemValue: "C85",
        },
        {
          fItemName: "其他",
          fItemValue: "其他",
        },
      ],
      djDataList: [
        {
          fItemName: "所有等级",
          fItemValue: "",
        },
        {
          fItemName: "正常",
          fItemValue: "0",
        },
        {
          fItemName: "初级",
          fItemValue: "1",
        },
        {
          fItemName: "中级",
          fItemValue: "2",
        },
        {
          fItemName: "高级",
          fItemValue: "3",
        },
      ],
      CloseoperationDataList: [
        {
          fItemName: "闭合状态",
          fItemValue: "",
        },
        {
          fItemName: "未闭合",
          fItemValue: "未闭合",
        },
        {
          fItemName: "已闭合",
          fItemValue: "已闭合",
        },
      ],
      level: [],
      earlyWarning: [],
      bhzDataList: [], //拌合站

      bhjDataList: [], //拌合机
      value2: "", //主页面日期筛选绑定值
      json_fields: {
        //导出Excel表格的表头设置
        // '序号': 'type',
        生产任务单号: "F_ProduceTaskNumber",
        项目名称: "F_ProjectName",
        工程名称: "F_EngineeringName",
        工程部位: "F_EngineeringPartName",
        拌合站: "F_StationId",
        拌合机: "F_MachineId",
        实际方量: "F_ActualCalculation",
        强度等级: "F_StrengthGrade",
        状态: "F_WarningLevel",
        出料时间: "dischargeDates",
        上传时间: "F_DischargeDates",
      },
      xlsxName: null,
      // 列表配置项
      table_config: {
        imgKeyWord: "url",
        fileKeyWord: "url",
        fileName: "fFileName",
        dialogHeight: "",
        thead: [
          {
            label: "生产任务单号",
            prop: "F_ProduceTaskNumber",
            minWidth: "150px",
            align: "left",
          },
          {
            label: "标段名称",
            prop: "F_CompanyName",
            minWidth: "130px",
            align: "left",
          },
          {
            label: "工程名称",
            prop: "F_EngineeringName",
            minWidth: "130px",
            align: "left",
          },
          {
            label: "工程部位",
            prop: "F_EngineeringPartName",
            minWidth: "180px",
            align: "left",
          },
          // {
          //     label: '拌合站', prop: 'F_StationId', minWidth: '120px',
          //     align: "center"
          // },
          // {
          //     label: '拌合机', prop: 'F_MachineId', minWidth: '120px',
          //     align: "center"
          // },
          //
          {
            label: "实际方量",
            prop: "F_ActualCalculation",
            minWidth: "80px",
            align: "center",
          },
          {
            label: "强度等级",
            prop: "F_StrengthGrade",
            minWidth: "80px",
            align: "center",
          },
          // {
          //     label: '状态1', prop: 'F_WarningLevel', minWidth: '80px',
          //     align: "center"
          // },
          // {
          //     label: '状态2', prop: 'F_StrengthGrade', minWidth: '80px',
          //     align: "center"
          // },
          {
            label: "预警级别",
            prop: "F_WarningLevel",
            minWidth: "100px",
            filter: true,
            btn: true,
            align: "center",
            colorName: "",
            callback: (rowData) => {
              let data = statusType[rowData.F_WarningLevel];
              if (data) {
                return data.label;
              }
            },
            specialClass: (rowData) => {
              let data = statusType[rowData.F_WarningLevel];
              if (data) {
                return data.className;
              }
            },
          },
          {
            label: "出料时间",
            prop: "dischargeDates",
            minWidth: "140px",
            align: "center",
          },
          {
            label: "上传时间",
            prop: "F_DischargeDates",
            minWidth: "140px",
            align: "center",
          },
        ],
        isCheckBox: false,
        isIndex: true,
        isOperation: true,
        // 表格操作列
        operation: {
          label: "操作",
          width: "100",
          detail: true,
          cols: [
            {
              label: "查看",
              type: "primary",
              handleRow: this.handleRow,
            },
            // {
            //     label: '删除',
            //     type: 'danger',
            //     handleRow: this.handleRow
            // }
          ],
        },
      },
      tableData: [], //表格列表数据列表
      tableDatas: [], //导出所有数据
      material_config: {
        //材料用量配置项
        classCell: true,
        thead: [
          {
            label: "",
            prop: "name",
            minWidth: "90px",
            align: "center",
          },
          {
            label: "水",
            prop: "water",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "水泥1",
            prop: "cement1",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "水泥2",
            prop: "cement2",
            minWidth: "60px",
            align: "center",
          },
          // , {
          //     label: '水泥3', prop: 'cement3', minWidth: '60px',
          //     routerPath: 'xxx'
          // },
          {
            label: "骨料1",
            prop: "aggregate1",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "骨料2",
            prop: "aggregate2",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "骨料3",
            prop: "aggregate3",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "骨料4",
            prop: "aggregate4",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "骨料5",
            prop: "aggregate5",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "矿粉",
            prop: "oredesign",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "粉煤灰	",
            prop: "flyash",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "外加剂1",
            prop: "admixture1",
            minWidth: "60px",
            align: "center",
          },
          {
            label: "外加剂2",
            prop: "admixture2",
            minWidth: "60px",
            align: "center",
          },
        ],
      }, //材料配置项
      materialData: [], //材料用量列表
      highlightBd: true, //左侧机构树停留背景色

      treelength: false, //左侧树显示隐藏
      checked: true, //查看下级按钮
      showName: "未选择公司",
      dialogHeight: "470px", //弹框高度
      fId: null, //点击当前列表数据fId
      listLoading: false, //列表数据加载loading
      loadingEditDialog: false, //弹框loading
      dialogEditVisible: false, //新增弹框是否显示
      // 列表给后端传参
      getList: {
        fCompanyid: "", // 施工标段id
        startDates: "", // 开始时间
        endDates: "", // 截至时间
        strengthgrade: "", // 强度等级
        stationId: "",
        machineId: "", // 拌和机编号
        keyWord: "", // 工程部位/工程名称 模糊条件
        page: 1, // 当前页码
        pageSize: 20, // 每页显示条数
        warningLevel: "", // 预警等级
        fCloseoperation: "", // 闭合状态
      },

      companyTree: "", //所有数据
      treeData: [], //左侧树状图数据

      // 左侧机构树
      defaultProps: {
        children: "children",
        label: "fShortname",
      },
      checkData: [],
      userInfo: {}, //登录用户
      treeText: {
        //树状图参数
        companyId: null,
        userId: null,
        text: null,
      },
    };
  },
  components: {
    tree, //左侧组织机构数
    TableData, //主页面列表
    elBreadcrumb, //面包屑
    publicForm, //弹框表格
    Pagination, //分页
    // selects,//下拉框
  },
  mounted() {
    this.userInfo = JSON.parse(sessionStorage.getItem("yjSmart-userInfo"));
    // var id = JSON.parse(sessionStorage.getItem("yjSmart-treeCheck"))
    if (JSON.parse(sessionStorage.getItem("yjSmart-getList"))) {
      this.getList = JSON.parse(sessionStorage.getItem("yjSmart-getList"));
    }
    if (JSON.parse(sessionStorage.getItem("yjSmart-treeCheck"))) {
      var id = JSON.parse(sessionStorage.getItem("yjSmart-treeCheck"));
      this.checkData = [id.fCompanyid];
    }
    // this.checkData = [id.fCompanyid];

    this.getTree();
    this.btnRole(this.name);
    this.getDate();
  },
  methods: {
    btnRole(name) {
      // 按钮权限
      var btnList = [];
      var ModuleList = JSON.parse(sessionStorage.getItem("yjSmart-ModuleList"));
      if (ModuleList.length > 0) {
        ModuleList.map((item) => {
          if (item.fEncode == name) {
            btnList = item.modulebuttonList;
          }
        });
        var btnStr = [];
        btnList.map((item) => {
          btnStr.push(item.fEncode);
        });
        this.yj_view = btnStr.includes("yj_view");
      } else {
        this.yj_view = true;
      }
    },
    // 点击当前行
    rowChange(val) {
      console.log(val);
    },
    // 左侧树结构
    getTree() {
      this.treeText = {
        companyId: this.userInfo.companyId,
        userId: this.userInfo.userId,
        text: "1", // 0其他  1 砼拌合站 2水稳 3沥青
      };
      getUserCompanyTreeList(this.treeText)
        .then((res) => {
          if (res.errcode == 0) {
            var companyTree = res.data.userCompanyTreeList;
            this.treeData = this.commonJs.tranListToTreeData(companyTree);

            if (this.treeData[0].children == undefined) {
              this.treelength = false; //左侧组织机构是否显示
            } else {
              this.treelength = true;
            }
            if (this.checkData[0]) {
              this.showName = JSON.parse(
                sessionStorage.getItem("yjSmart-treeCheck")
              ).fShortname;
              this.getList.fCompanyid = this.checkData[0];
              this.mixingPlantList(0, this.getList);
              this.mixingPlantList(1, this.getList);
            } else {
              this.showName = this.treeData[0].fShortname; //当前点击组织机构名称
              this.getList.fCompanyid = this.treeData[0].fCompanyid; //当前点击组织机构ID
            }

            this.yj_searchForm(this.getList); // 调用主页面列表接口
            // 列表
          } else {
            this.$message.error(res.msg);
            // this.$message.error("获取组织机构失败");
            return false;
          }
        })
        .catch(() => {
          return false;
        });
    },

    // 点击左侧机构树
    handleNodeClick(data) {
      this.showName = data.fShortname; //顶部显示机构名
      this.getList.fCompanyid = data.fCompanyid;
      this.mixingPlantList(0, this.getList);
      this.mixingPlantList(1, this.getList);
      var time = new Date();
      const y = time.getFullYear();
      const m = (time.getMonth() + 1 + "").padStart(2, "0");
      const d = (time.getDate() + "").padStart(2, "0");
      const hh = (time.getHours() + "").padStart(2, "0");
      const mm = (time.getMinutes() + "").padStart(2, "0");
      const ss = (time.getSeconds() + "").padStart(2, "0");
      // if (JSON.parse(sessionStorage.getItem("yjSmart-getList"))) {
      //     this.getList = JSON.parse(sessionStorage.getItem("yjSmart-getList"))

      // } else {
      this.getList.startDates = `2020-01-01 00:00:00`; // 开始时间
      this.getList.endDates = `${y}-${m}-${d} ${hh}:${mm}:${ss}`; // 截至时间
      this.getList.strengthgrade = ""; // 强度等级
      this.getList.machineId = ""; // 拌和机编号
      this.getList.stationId = "";
      this.getList.warningLevel = ""; // 预警等级
      this.getList.fCloseoperation = ""; // 闭合状态
      this.value2 = ["2020-01-01 00:00:00", `${y}-${m}-${d} ${hh}:${mm}:${ss}`];
      // console.log(this.getList);
      // }
      // this.getList.startDates = `2020-01-01 00:00:00`// 开始时间
      // this.getList.endDates = `${y}-${m}-${d} ${hh}:${mm}:${ss}`// 截至时间
      // this.getList.strengthgrade = ""// 强度等级
      // this.getList.machineId = ""// 拌和机编号
      this.getList.page = 1;
      this.yj_searchForm(this.getList);
    },
    // 获取列表数据
    yj_searchForm(data) {
      this.listLoading = true;
      window.sessionStorage.setItem("yjSmart-getList", JSON.stringify(data));
      getMixListByCompanyId(data)
        .then((res) => {
          if (res.errcode == 0) {
            var that = this;
            that.listLoading = false;
            that.tableData = res.data.pageInfo.list;
            this.queryCriteriaData = res.data.pageInfo; //分页信息
            // this.yj_searchForms(this.getList)

            this.navigatepageNums =
              this.queryCriteriaData.navigatepageNums.length;
            // this.downloadExcel()
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    downloadExcel() {
      var data = {
        fCompanyid: this.getList.fCompanyid, // 施工标段id
        startDates: this.getList.startDates, // 开始时间
        endDates: this.getList.endDates, // 截至时间
        strengthgrade: this.getList.strengthgrade, // 强度等级
        machineId: this.getList.machineId, // 拌和机编号
        stationId: this.getList.stationId,
        keyWord: this.getList.keyWord, // 工程部位/工程名称 模糊条件
        page: 1, // 当前页码
        pageSize: this.queryCriteriaData.total, // 每页显示条数
      };
      getMixListByCompanyId(data)
        .then((res) => {
          if (res.errcode == 0) {
            var that = this;
            var datas = res.data.pageInfo.list;
            datas.map((item) => {
              if (item.F_WarningLevel == 0) {
                item.F_WarningLevel = "正常";
              } else if (item.F_WarningLevel == 1) {
                item.F_WarningLevel = "初级";
              } else if (item.F_WarningLevel == 2) {
                item.F_WarningLevel = "中级";
              } else if (item.F_WarningLevel == 3) {
                item.F_WarningLevel = "高级";
              }
            });

            that.tableDatas = res.data.pageInfo.list;
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    // 查看
    yj_viewForm(row) {
      this.fId = row.F_Id;
      var id = row.F_Id;
      this.fPhotofilelist = [];
      if (id != "" && id != null) {
        this.dialogEditVisible = true;
        this.loadingEditDialog = false;

        getStationmachineByfMachineid({ machineId: row.F_MachineId })
          .then((res1) => {
            if (res1.errcode == 0) {
              // console.log(res1);
              this.material_config.thead[4].label =
                res1.data.yjQmpMsStationmachine.fParm1;
              this.material_config.thead[5].label =
                res1.data.yjQmpMsStationmachine.fParm2;
              this.material_config.thead[6].label =
                res1.data.yjQmpMsStationmachine.fParm3;
              this.material_config.thead[7].label =
                res1.data.yjQmpMsStationmachine.fParm4;
              this.material_config.thead[8].label =
                res1.data.yjQmpMsStationmachine.fParm5;
              getMixInfoById({ fId: id }).then((res) => {
                if (res.errcode == 0) {
                  console.log(res.data);
                  var that = this;
                  that.loadingEditDialog = false;
                  that.dialogEditVisible = true;
                  that.formData = res.data.dischargeinfo;
                  this.materialData = [
                    {
                      // fCement2deviatevalue
                      name: "设计重量值(kg)",
                      water: res.data.dischargeinfo.fWaterdesignvalue,
                      cement1: res.data.dischargeinfo.fCement1designvalue,
                      cement2: res.data.dischargeinfo.fCement2designvalue,
                      aggregate1: res.data.dischargeinfo.fAggregate1designvalue,
                      aggregate2: res.data.dischargeinfo.fAggregate2designvalue,
                      aggregate3: res.data.dischargeinfo.fAggregate3designvalue,
                      aggregate4: res.data.dischargeinfo.fAggregate4designvalue,
                      aggregate5: res.data.dischargeinfo.fAggregate5designvalue,
                      oredesign: res.data.dischargeinfo.fOredesignvalue,
                      flyash: res.data.dischargeinfo.fFlyashdesignvalue,
                      admixture1: res.data.dischargeinfo.fAdmixture1designvalue,
                      admixture2: res.data.dischargeinfo.fAdmixture2designvalue,
                      // cement3: "",
                    },
                    {
                      name: "实际称量值(kg)",
                      water: res.data.dischargeinfo.fWateractualvalue,
                      cement1: res.data.dischargeinfo.fCement1actualvalue,
                      cement2: res.data.dischargeinfo.fCement2actualvalue,
                      // cement3: "",
                      aggregate1: res.data.dischargeinfo.fAggregate1actualvalue,
                      aggregate2: res.data.dischargeinfo.fAggregate2actualvalue,
                      aggregate3: res.data.dischargeinfo.fAggregate3actualvalue,
                      aggregate4: res.data.dischargeinfo.fAggregate4actualvalue,
                      aggregate5: res.data.dischargeinfo.fAggregate5actualvalue,
                      oredesign: res.data.dischargeinfo.fOreactualvalue,
                      flyash: res.data.dischargeinfo.fFlyashactualvalue,
                      admixture1: res.data.dischargeinfo.fAdmixture1actualvalue,
                      admixture2: res.data.dischargeinfo.fAdmixture2actualvalue,
                    },
                    {
                      name: "重量偏差(%)",
                      water: res.data.dischargeinfo.fWaterdeviatevalue, //水
                      cement1: res.data.dischargeinfo.fCement1deviatevalue, //水泥1
                      cement2: res.data.dischargeinfo.fCement2deviatevalue, //水泥2
                      aggregate1:
                        res.data.dischargeinfo.fAggregate1deviatevalue, //骨料1
                      aggregate2:
                        res.data.dischargeinfo.fAggregate2deviatevalue, //骨料2
                      aggregate3:
                        res.data.dischargeinfo.fAggregate3deviatevalue, //骨料3
                      aggregate4:
                        res.data.dischargeinfo.fAggregate4deviatevalue, //骨料4
                      aggregate5:
                        res.data.dischargeinfo.fAggregate5deviatevalue, //骨料5
                      oredesign: res.data.dischargeinfo.fOredeviatevalue, //矿粉
                      flyash: res.data.dischargeinfo.fFlyashdeviatevalue, //粉煤灰
                      admixture1:
                        res.data.dischargeinfo.fAdmixture1deviatevalue, //外加剂1
                      admixture2:
                        res.data.dischargeinfo.fAdmixture2deviatevalue, //外加剂2
                    },
                    {
                      name: "",
                      show: true,
                      water: res.data.dischargeinfo.fWaterwarninginfo, //水
                      cement1: res.data.dischargeinfo.fCement1warninginfo, //水泥1
                      cement2: res.data.dischargeinfo.fCement2warninginfo, //水泥2
                      aggregate1: res.data.dischargeinfo.fAggregate1warninginfo, //骨料1
                      aggregate2: res.data.dischargeinfo.fAggregate2warninginfo, //骨料2
                      aggregate3: res.data.dischargeinfo.fAggregate3warninginfo, //骨料3
                      aggregate4: res.data.dischargeinfo.fAggregate4warninginfo, //骨料4
                      aggregate5: res.data.dischargeinfo.fAggregate5warninginfo, //骨料5
                      oredesign: res.data.dischargeinfo.fOrewarninginfo, //矿粉
                      flyash: res.data.dischargeinfo.fFlyashwarninginfo, //粉煤灰
                      admixture1: res.data.dischargeinfo.fAdmixture1warninginfo, //外加剂1
                      admixture2: res.data.dischargeinfo.fAdmixture2warninginfo, //外加剂2
                    },
                  ];
                  this.level = [
                    "",
                    res.data.dischargeinfo.fWaterwarninglevel,
                    res.data.dischargeinfo.fCement1warninglevel,
                    res.data.dischargeinfo.fCement2warninglevel,
                    res.data.dischargeinfo.fAggregate1warninglevel,
                    res.data.dischargeinfo.fAggregate2warninglevel,
                    res.data.dischargeinfo.fAggregate3warninglevel,
                    res.data.dischargeinfo.fAggregate4warninglevel,
                    res.data.dischargeinfo.fAggregate5warninglevel,
                    res.data.dischargeinfo.fOrewarninglevel,
                    res.data.dischargeinfo.fFlyashwarninglevel,
                    res.data.dischargeinfo.fAdmixture1warninglevel,
                    res.data.dischargeinfo.fAdmixture2warninglevel,
                  ];
                  this.earlyWarning = [
                    "",
                    res.data.dischargeinfo.fWaterwarninginfo,
                    res.data.dischargeinfo.fCement1warninginfo,
                    res.data.dischargeinfo.fCement2warninginfo,
                    res.data.dischargeinfo.fAggregate1warninginfo,
                    res.data.dischargeinfo.fAggregate2warninginfo,
                    res.data.dischargeinfo.fAggregate3warninginfo,
                    res.data.dischargeinfo.fAggregate4warninginfo,
                    res.data.dischargeinfo.fAggregate5warninginfo,
                    res.data.dischargeinfo.fOrewarninginfo,
                    res.data.dischargeinfo.fFlyashwarninginfo,
                    res.data.dischargeinfo.fAdmixture1warninginfo,
                    res.data.dischargeinfo.fAdmixture2warninginfo,
                  ];

                  var Cement1 = null; //水泥1
                  if (
                    res.data.dischargeinfo.fCement1actualvalue != null &&
                    res.data.dischargeinfo.fCement1actualvalue != null
                  ) {
                    Cement1 = res.data.dischargeinfo.fCement1actualvalue - 0;
                  } else {
                    Cement1 = 0;
                  }
                  var Cement2 = null; //水泥2
                  if (
                    res.data.dischargeinfo.fCement2actualvalue != null &&
                    res.data.dischargeinfo.fCement2actualvalue != null
                  ) {
                    Cement2 = res.data.dischargeinfo.fCement2actualvalue - 0;
                  } else {
                    Cement2 = 0;
                  }
                  var Oreactual = null; //矿粉
                  if (
                    res.data.dischargeinfo.fOreactualvalue != null &&
                    res.data.dischargeinfo.fOreactualvalue != null
                  ) {
                    Oreactual = res.data.dischargeinfo.fOreactualvalue - 0;
                  } else {
                    Oreactual = 0;
                  }
                  var Flyashactual = null; //粉煤灰
                  if (
                    res.data.dischargeinfo.fFlyashactualvalue != null &&
                    res.data.dischargeinfo.fFlyashactualvalue != null
                  ) {
                    Flyashactual =
                      res.data.dischargeinfo.fFlyashactualvalue - 0;
                  } else {
                    Flyashactual = 0;
                  }
                  var Admixture1 = null; //外加剂1
                  if (
                    res.data.dischargeinfo.fAdmixture1actualvalue != null &&
                    res.data.dischargeinfo.fAdmixture1actualvalue != null
                  ) {
                    Admixture1 =
                      res.data.dischargeinfo.fAdmixture1actualvalue - 0;
                  } else {
                    Admixture1 = 0;
                  }
                  var Admixture2 = null; //外加剂2
                  if (
                    res.data.dischargeinfo.fAdmixture2actualvalue != null &&
                    res.data.dischargeinfo.fAdmixture2actualvalue != null
                  ) {
                    Admixture2 =
                      res.data.dischargeinfo.fAdmixture2actualvalue - 0;
                  } else {
                    Admixture2 = 0;
                  }
                  // 水胶比=水/胶凝材料（水泥+矿粉+粉煤灰）
                  var fWaterbinderratio =
                    res.data.dischargeinfo.fWateractualvalue /
                    (Cement1 + Cement2 + Oreactual + Flyashactual);
                  this.formData.fWaterbinderratio =
                    Math.floor(fWaterbinderratio * 100) / 100;

                  // 外加剂掺量=外加剂/胶凝材料（水泥+矿粉+粉煤灰）*100
                  var fAdditiveratio =
                    ((Admixture1 + Admixture2) /
                      (Cement1 + Cement2 + Oreactual + Flyashactual)) *
                    100;
                  this.formData.fAdditiveratio =
                    Math.floor(fAdditiveratio * 100) / 100;
                } else {
                  this.$message.error(res.msg);
                }
              });
            } else {
              this.$message.error(res1.msg);
              console.log("接口报错");
            }
          })
          .catch((error) => {
            console.log("拌合站设置编辑报错", error);
          });
      } else {
        return this.$message.error("请先选择需要查看的数据");
      }
    },

    // 获取拌合机数据
    mixingPlantList(num, datas) {
      // // this.getList.fCompanyid this.checkData[0]
      var data = {
        companyId: datas.fCompanyid, // 施工标段id
        modelType: num, // 类型
        stationType: "1", // 拌合站类型
      };
      // if (this.checkData[0]) {
      //     data = {
      //         companyId: this.checkData[0],// 施工标段id
      //         modelType: num// 类型
      //     }
      // } else {
      //     data = {
      //         companyId: this.getList.fCompanyid,// 施工标段id
      //         modelType: num// 类型
      //     }
      // }

      this.bhjDataList = [];
      getStationmachineList(data)
        .then((res) => {
          if (res.errcode == 0) {
            var arr = res.data.stationmachineList;
            if (num == 1) {
              this.bhjDataList = [
                {
                  fItemName: "所有拌和机",
                  fItemValue: "",
                },
              ];
              arr.map((item) => {
                this.bhjDataList.push({
                  fItemName: item.fMachinename,
                  fItemValue: item.fMachineid,
                });
              });
            } else if (num == 0) {
              this.bhzDataList = [
                {
                  fItemName: "所有拌和站",
                  fItemValue: "",
                },
              ];
              arr.map((item) => {
                this.bhzDataList.push({
                  fItemName: item.fMachinename,
                  fItemValue: item.fMachineid,
                });
              });
            }
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },

    // 时间间隔
    // selectTime() {
    //     this.getList.startDates = this.value2[0] + " " + "00:00:00"// 开始时间
    //     this.getList.endDates = this.value2[1] + " " + "23:59:59"// 截至时间
    //     this.xlsxName = this.value2[0] + '至' + this.value2[1] + '混凝土拌和站记录数据'

    //     this.yj_searchForm(this.getList);
    // },
    selectTime(e) {
      if (e[0] != "" && e[1] != "") {
        this.getList.startDates = e[0] + " " + "00:00:00"; // 开始时间
        this.getList.endDates = e[1] + " " + "23:59:59"; // 截至时间
      } else {
        this.getList.startDates = ""; // 开始时间
        this.getList.endDates = ""; // 截至时间
      }
      this.yj_searchForm(this.getList);
    },

    getDate() {
      var time = new Date();
      const y = time.getFullYear();
      const m = (time.getMonth() + 1 + "").padStart(2, "0");
      const d = (time.getDate() + "").padStart(2, "0");
      const hh = (time.getHours() + "").padStart(2, "0");
      const mm = (time.getMinutes() + "").padStart(2, "0");
      const ss = (time.getSeconds() + "").padStart(2, "0");
      if (JSON.parse(sessionStorage.getItem("yjSmart-getList"))) {
        this.getList = JSON.parse(sessionStorage.getItem("yjSmart-getList"));
        this.getList.page = 1;
        this.value2 = [this.getList.startDates, this.getList.endDates];
        this.xlsxName =
          this.getList.startDates +
          "至" +
          this.getList.endDates +
          "混凝土拌和站记录数据";
      } else {
        this.getList.startDates = `2020-01-01 00:00:00`; // 开始时间
        this.getList.endDates = `${y}-${m}-${d} ${hh}:${mm}:${ss}`; // 截至时间
        this.value2 = [
          "2020-01-01 00:00:00",
          `${y}-${m}-${d} ${hh}:${mm}:${ss}`,
        ];
        this.xlsxName =
          `${y}-${m}-01` + "至" + `${y}-${m}-${d}` + "混凝土拌和站记录数据";
        console.log(this.getList);
      }
      // this.getList.startDates = `2020-01-01 00:00:00`// 开始时间
      // this.getList.endDates = `${y}-${m}-${d} ${hh}:${mm}:${ss}`// 截至时间
      // this.value2 = ['2020-01-01 00:00:00', `${y}-${m}-${d} ${hh}:${mm}:${ss}`]
      // this.xlsxName = `${y}-${m}-01` + '至' + `${y}-${m}-${d}` + '混凝土拌和站记录数据'
    },
    // 获取页面容器高度
    getHeight() {
      // var h = document.documentElement.clientHeight; //获取页面可见高度
      // this.dialogHeight = h * 0.50 + "px";
    },
    // 多选方法
    selectionChange() {},
    // 排序方法
    sortChange() {},
  },
};
</script>
  
<style scoped>
.printTables {
  background: #fff;
  display: flex;
  justify-content: end;
  padding: 5px;
  margin-top: 10px;
}

.dialogBody {
  padding: 3px 20px;
  height: 80%;
  overflow-y: auto;
}

.baseTitle {
  /* border: 1px solid #0c204d; */
  border-bottom: 1px solid #0c204d;

  height: 30px;
  line-height: 30px;
  position: relative;
  padding-left: 15px;
}

.baseTitle::after {
  display: block;
  content: "";
  height: 30px;
  width: 5px;
  position: absolute;
  left: 0;
  top: 0;
  background: #0c204d;
}

.materialClass /deep/.el-table tr:nth-child(4) {
  display: none;
}
</style>